﻿/*=======================================================================================
	TASK 4:                                                         {Console InputOutput}
	Write a program that reads two positive integer numbers and prints how many numbers p
    exist between them such that the reminder of the division by 5 is 0 (inclusive).
    Example: p(17,25) = 2.  
=======================================================================================*/

using System;

class HowmanyDevisionBy5inInterval
{
    static void Main()
    {
        Console.Write("Enter first positive number a=");
        int a = int.Parse(Console.ReadLine());

        Console.Write("Enter second positive number b=");
        int b=int.Parse(Console.ReadLine());

        int c = Math.Abs((a/5)-(b/5));
        Console.WriteLine("p({0},{1}){3}{2}",a,b,c,'\u2192');

        
        bool check = (a > 0) && (b > 0);

        int counter=0;
        if (check)
        {
            if (a<b)
            {
                for (int i = a; i <=b ; i++)
                {
                    if (i % 5 == 0)
                    {
                        counter++;
                    }
                }
                Console.WriteLine("p({0},{1}){3}{2}",a,b,counter,'\u2192');
            }

            else
            {
                for (int i = b; i <= a; i++)
                {
                     if (i % 5 == 0)
                    {
                        counter+=counter;
                    }
                }
                Console.WriteLine("p({0},{1}){3}{2}", a, b, counter, '\u2192');
            }
        }
        else
        {
            Console.WriteLine(".Invalide numbers.Enter two positive numbers");
        }
    }
}

